import 'package:uuid/uuid.dart';

class Tag {
  String id;
  String name;

  Tag(String name) : id = const Uuid().v4(), this.name = name;

  Tag.fromJson(Map<String, dynamic> json)
      : id = json['id'] as String,
        name = json['name'] as String;

  Map<String, dynamic> toJson() => {
    'id': id,
    'name': name
  };

  @override
  int get hashCode => id.hashCode ^ name.hashCode;

  @override
  bool operator ==(Object other) {
    return other is Tag && other.id == id && other.name == name;
  }

  static List<Tag> preset() {
    return [
      Tag('搓盘'),
      Tag('charge'),
      Tag('搓盘复合'),
      Tag('楼梯'),
      Tag('Peak'),
      Tag('note'),
      Tag('纵连'),
      Tag('双楼梯'),
      Tag('胶囊'),
      Tag('Denim')
    ];
  }
}